/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAL;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author HOANG ANH
 */
public class DABasic {

    private Connection conn;
    private String uri = "jdbc:sqlserver://localhost:1433;databaseName=employeeDB;username=sa;password=fat123456";

    public DABasic() {
    }

    public Connection getConnection() throws SQLException, ClassNotFoundException {
        if (conn != null) {
            if (!conn.isClosed()) {
                conn.close();
            }
        }

        Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
        conn = DriverManager.getConnection(uri);
        return conn;
    }
}
